using UnityEngine;
using System.Collections;

public class DecisionTimer : MonoBehaviour {
	
	float timerInSeconds;
	float startTime;
	public float maxTime;
	GameObject timesUp;
	GameObject buttons;
	
	// Use this for initialization
	void Start () {
		Debug.Log("Timer Started at: " + timerInSeconds);
		startTime = timerInSeconds = Time.time;
		timesUp = GameObject.Find("Time's Up");
		timesUp.guiTexture.enabled = false;
		buttons = GameObject.Find("Buttons");
	}
	
	// Update is called once per frame
	void Update () {
		if (timerInSeconds < startTime + maxTime) // Is the timer at the maxTime yet?
		{
			timerInSeconds = Time.time; // NOTE: Need to double check that this works 100% of the time.
			//Debug.Log("Timer at: " + timerInSeconds);
		}
		else
		{
			timesUp.guiTexture.enabled = true;
			buttons.active = false;
		}
	}
	
	public string GetQuestion(){
		return "yes";
	}
	
	public float getTimeRemaining()
	{
		return maxTime - timerInSeconds;	
	}
	
	public void resetTimer()
	{
		startTime = timerInSeconds = Time.time;
	}
}
